<?php

namespace app\app\controller;

use app\app\model\ProjectDKModel;
use app\app\model\ProjectRiskModel;
use app\app\model\ProjectTDModel;
use app\BaseController;


class Census extends BaseController
{
    /**
     *  当天风险履职情况(待完善)
     */
    public function perform(){
        $time = $this->getTime('today');

        $where[] = ['start_time', '<=', $time['end_time']];
        $where[] = ['end_time', '>=', $time['start_time']];
        $risk_num_2 = ProjectRiskModel::where($where)->where('risk_level', '=', 2)->count();
        var_dump($risk_num_2);die();

        //当天风险打卡条件
        $where_dk[] = ['dk_time_in', 'between', [$time['start_time'], $time['end_time']]];

        //当天二级风险数的项目
        $risk_list_2 = ProjectRiskModel::where($where)
            ->where('risk_level', '=', 2)
            ->group('project_name')
            ->select()->toArray();

        $info_2 = array_column($risk_list_2, 'project_id');
        $ids_2 = implode(",", $info_2);
        $where_risk_2[] = ['project_id', 'in', $ids_2];


        //当天二级风险打卡数
        $risk_dk_2 = ProjectDKModel::where($where_risk_2)->where($where_dk)->count();



    }








}
